﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;

namespace LuKou.Web.Core
{
    public static class WebConfig
    {
        /// <summary>
        /// 网站信息前缀
        /// </summary>
        public static string PrefixKey { get; private set; }

        /// <summary>
        /// 网站文件扩展名
        /// </summary>
        public static string ExtendName { get; private set; }

        /// <summary>
        /// 用户加密密钥
        /// </summary>
        public static string PasswordKey { get; private set; }

        /// <summary>
        /// 商家加密密钥
        /// </summary>
        public static string SellerKey { get; private set; }

        /// <summary>
        /// 管理员加密密钥
        /// </summary>
        public static string AdminPasswordKey { get; private set; }

        static WebConfig()
        { 
            PrefixKey = ConfigurationManager.AppSettings["PrefixKey"];
            if (string.IsNullOrEmpty(PrefixKey))
                PrefixKey = "LuKou_";

            ExtendName = ConfigurationManager.AppSettings["ExtendName"];
            if (string.IsNullOrEmpty(ExtendName))
                ExtendName = string.Empty;

            AdminPasswordKey = ConfigurationManager.AppSettings["AdminPasswordKey"];
            if (string.IsNullOrEmpty(AdminPasswordKey))
                AdminPasswordKey = "ij#d$FT~3^";

            SellerKey = ConfigurationManager.AppSettings["SellerKey"];
            if (string.IsNullOrEmpty(SellerKey))
                SellerKey = "lDF%^4#p&l";

            PasswordKey = ConfigurationManager.AppSettings["PasswordKey"];
            if (string.IsNullOrEmpty(PasswordKey))
                PasswordKey = "SMSWebPWD";
            if (PasswordKey.Length > 8)
                PasswordKey = PasswordKey.Substring(0, 8);
        }
    }
}
